package com.cf.message.model.service;

import com.cf.crud.service.AbsBaseService;
import com.cf.id.SnowflakeId;
import com.cf.message.model.SmsSendLog;
import com.cf.message.model.dao.SmsSendLogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * boot-message-SmsSendLogService
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/7/25 下午 06:24
 */
@Service
public class SmsSendLogService extends AbsBaseService<SmsSendLog, SmsSendLogDao> {

    @Autowired
    private SnowflakeId id;

    @Override
    public Class getTargetClass() {
        return SmsSendLog.class;
    }

    public void addLog(String phone, String sendData, String resultCode, String errorReason) {
        SmsSendLog smsSendLog = new SmsSendLog();
        smsSendLog.setData(sendData);
        smsSendLog.setErrorReason(errorReason);
        smsSendLog.setPhone(phone);
        smsSendLog.setResultCode(resultCode);
        smsSendLog.setId(id.nextId());
        this.mapper.insert(smsSendLog);
    }
}
